package com.moarea.app.service.impl.log;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.moarea.app.dao.SystemLogMapper;
import com.moarea.app.mybatis.model.PagedObject;
import com.moarea.app.service.abst.ABillBaseService;
import com.moarea.app.service.inter.log.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 日志
 * 时间：2017-05-22
 * <p>
 * 嵇众
 */
@Service(value = "logService")
public class LogService extends ABillBaseService implements ILogService {

    @Autowired
    private SystemLogMapper systemLogMapper;

    @Override
    public PagedObject<List<Map<String, Object>>> selectAllPaged(Map<String, Object> param, int pageNum, int pageSize, int count) {
        Page<Map<String, Object>> page = PageHelper.startPage(pageNum, pageSize, count < 0);
        List<Map<String, Object>> list = systemLogMapper.selectAllPaged(param);
        PagedObject<List<Map<String, Object>>> pagedObject = new PagedObject<List<Map<String, Object>>>(list, count < 0 ? (int) page.getTotal() : count);
        return pagedObject;
    }
}
